Skip to content

feat: configurable health scoring weights via mcpwc.config.json#231

Merged
himerus merged 1 commit intodevfrom
feature/feat-configurable-health-scoring
Mar 27, 2026
Merged

feat: configurable health scoring weights via mcpwc.config.json#231
himerus merged 1 commit intodevfrom
feature/feat-configurable-health-scoring

Conversation

@himerus
Copy link
Copy Markdown
Contributor

@himerus himerus commented Mar 27, 2026

Summary

Allow Enterprises to Customize Health Scoring Weights

Currently health scoring uses hardcoded weights for each dimension (documentation, accessibility, naming, API consistency, etc.). Enterprise teams have different priorities — a design system team may weight accessibility at 3x while a rapid prototyping team may weight it at 0.5x.

Implementation

  1. Add optional scoring section to mcpwc.config.json schema:
    {
      "scoring": {
        "weights": {
          "documentatio...
    

Created automatically by Automaker

Summary by CodeRabbit

  • New Features

    • Configurable health scoring weights—users can now customize multipliers for individual health dimensions via configuration, with validation that rejects non-positive values.
  • Documentation

    • Added comprehensive "Configurable Health Scoring Weights" section with JSON examples demonstrating accessibility-first and rapid-prototyping weight configurations.

Add optional scoring.weights config section to helixir.mcp.json
that lets enterprise teams apply per-dimension weight multipliers
to health scores. Accessibility-first teams can weight that
dimension 3× while rapid-prototyping teams can downweight it 0.5×.

- Add ScoringWeights and ScoringConfig interfaces to McpWcConfig
- Parse and validate scoring.weights in loadConfig() (positive
  numbers only; warn and discard invalid values)
- Export DIMENSION_WEIGHT_KEYS mapping from dimensions.ts
- Apply multipliers via getEffectiveWeight() in
  scoreComponentMultiDimensional()
- Default multiplier is 1.0 (fully backward-compatible)
- Document all 14 dimension keys in README with examples

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@himerus himerus merged commit ccc8305 into dev Mar 27, 2026
4 of 7 checks passed
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 27, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ef52f3d6-7f49-4be3-9ca9-c9490722c1c8

📥 Commits

Reviewing files that changed from the base of the PR and between f46d56e and a39e02f.

📒 Files selected for processing (5)
  • README.md
  • packages/core/src/config.ts
  • packages/core/src/handlers/dimensions.ts
  • packages/core/src/handlers/health.ts
  • tests/handlers/configurable-health-scoring.test.ts

Walkthrough

This PR adds configurable per-dimension health scoring weights by introducing a new optional scoring configuration section in the config file. It includes TypeScript types for the configuration, validation logic, a mapping of config keys to dimensions, and integration into the health scoring engine to apply weight multipliers from configuration.

Changes

Cohort / File(s) Summary
Configuration Documentation
README.md
Added documentation for the new scoring configuration object with scoring.weights per-dimension multiplier overrides, including behavior specification and JSON examples.
Configuration Types & Validation
packages/core/src/config.ts
Added ScoringWeights and ScoringConfig exported interfaces; extended McpWcConfig with optional scoring field; introduced validateScoringWeights() and parseScoringConfig() helpers with filtering of non-positive values and warning output.
Dimension Weight Mapping
packages/core/src/handlers/dimensions.ts
Added exported constant DIMENSION_WEIGHT_KEYS providing a read-only mapping from scoring config keys to dimension registry names.
Health Scoring Integration
packages/core/src/handlers/health.ts
Added getEffectiveWeight() helper; updated scoreComponentMultiDimensional to read config weights once and apply multipliers to all dimension entries (native and external) via computed effectiveWeight.
Test Suite
tests/handlers/configurable-health-scoring.test.ts
Comprehensive Vitest suite validating DIMENSION_WEIGHT_KEYS mappings, weight application behavior, config loading with validation, and scoring calculations with multiplier overrides.

Sequence Diagram

sequenceDiagram
    participant App as Application
    participant Loader as Config Loader
    participant Parser as Scoring Parser
    participant Scorer as Health Scorer
    participant Registry as Dimension Registry

    App->>Loader: loadConfig()
    Loader->>Parser: parseScoringConfig(raw.scoring)
    Parser->>Parser: validateScoringWeights()
    Note over Parser: Filter non-positive values,<br/>warn on invalid entries
    Parser-->>Loader: ScoringConfig object
    Loader-->>App: McpWcConfig with scoring

    App->>Scorer: scoreComponentMultiDimensional(component, config)
    Scorer->>Registry: DIMENSION_REGISTRY entries
    loop For each dimension
        Scorer->>Scorer: getEffectiveWeight(baseWeight,<br/>dimensionName,<br/>config.scoring.weights)
        Scorer->>Scorer: effectiveWeight = baseWeight × multiplier
    end
    Scorer-->>App: Scored dimensions with applied weights
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/feat-configurable-health-scoring

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant